<?php
/**
 * DynaGrid - The PHP datagrid
 *
 * @package    DynaGrid
 * @author     $Author: keesschepers $
 * @version    $Id: Table.php 13 2011-02-14 07:23:17Z keesschepers $
 */

include_once 'CollectionObject.php';
include_once 'HTML/Abstract.php';
include_once 'HTML/Table/Columns.php';
include_once 'HTML/Table/Column.php';
include_once 'HTML/Table/Header.php';
include_once 'HTML/Table/Footer.php';
include_once 'HTML/Table/Body.php';
include_once 'HTML/Table/Caption.php';

class DynaGrid_HTML_Table extends DynaGrid_HTML_Abstract {
	protected $tagname = 'table';
	private $header;
	public $body;
	private $footer;
	public $caption;
	/**
	 * Is a collection object which stores the definitions on how
	 * columns are marked up, the format of the data they contain etc.
	 *
	 * @var DynaGrid_Table_Columns
	 */
	public $columns;
	public function __construct(DynaGrid_DataSource &$dataset) {
		$this->columns = new DynaGrid_HTML_Table_Columns($dataset);
		$this->caption = new DynaGrid_HTML_Table_Caption();
		$this->header = new DynaGrid_HTML_Table_Header($this->columns);
		$this->body = new DynaGrid_HTML_Table_Body($this->columns);
		$this->footer = new DynaGrid_HTML_Table_Footer();
	}
	public function getHTML() {
		$this->innerHTML = $this->caption->getHTML();
		$this->innerHTML .= $this->header->getHTML();
		$this->innerHTML .= $this->body->getHTML();
		$this->innerHTML .= $this->footer->getHTML();
		
		return parent::getHTML();
	}
}